<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/11/19
 * Time: 15:56
 */
//include_once(ROOTDIR.'conf/db.config.php');

class Functiondata_con  extends Lxbase{

    public $where;
    public $modules=array(
        'Home'=>'首页',
        'Classify'=>'网站分类',
        'Img'=>'图文回复',
        'Company'=>'LBS信息',
        'Live'=>'微场景',
        'Adma'=>'DIY宣传页',
        'Photo'=>'相册',
        'Selfform'=>'万能表单',
        'Host'=>'商家订单',
        'Groupon'=>'团购',
        'Shop'=>'商城',
        'Repast'=>'订餐',
        'Wedding'=>'婚庆喜帖',
        'Vote'=>'投票',
        'Panorama'=>'全景',
        'Lottery'=>'大转盘',
        'Guajiang'=>'刮刮卡',
        'Coupon'=>'优惠券',
        'MemberCard'=>'会员卡',
        'Estate'=>'微房产',
        'Message'=>'留言板',
        'Car'=>'汽车',
        'GoldenEgg'=>'砸金蛋',
        'LuckyFruit'=>'水果机',
        'AppleGame'=>'走鹊桥',
        'Lovers'=>'摁死情侣',
        'Autumn'=>'吃月饼',
        'Problem'=>'一战到底',
        'Forum'=>'论坛',
        'GreetingCard'=>'贺卡',
        'Medical'=>'微医疗',
        'School'=>'微教育',
        'Hotels'=>'酒店宾馆',
        'Business'=>'行业应用',
        'Market'=>'微商圈',
        'Research'=>'微调研',
        'Fansign'=>'微信签到',
        'Shake'=>'摇一摇',
        'Jiugong'=>'九宫格',
        'OutsideLink'=>'<font color="red">生活服务</font>',
    );
    public $arr =array(0 => 'game',  1 => 'Invite',  2 => 'Red_packet',  3 => ' Seckill', 4 => 'Autumns', 5 => 'Popularity',  6 => 'Helping', 7 => 'Jiugong', 8 => 'MicroBroker', 9 => 'Crowdfunding',   10 => 'Unitary', 11 => 'DishOut',   12 => 'Bargain', 13 => 'SeniorScene', 14 => 'Test', 15 => 'Service', 16 => 'Hongbao', 17 => 'SeniorCard', 18 => 'Seckill', 19 => 'ServiceChat', 20 => 'Voteimg', 21 => 'Micrstore', 22 => 'Person_card', 23 => 'Cutprice', 24 => 'Punish', 25 => 'Numqueue',);
    public  $db;
   // public  $dbconn = array( "host"=>'103.7.222.41', "user"=>'b2ctest', "pass"=>'B2@c@2tE8T', "name"=>'qiyuedb',);
   // public  $dbconn = $dbconn ;
    public $token ;

 /* public function _initialize() {
        parent::_initialize();
        $this->where=array('token'=>$this->token);
        $this->modules=array(
            'Home'=>'首页',
            'Classify'=>'网站分类',
            'Img'=>'图文回复',
            'Company'=>'LBS信息',
            'Live'=>'微场景',
            'Adma'=>'DIY宣传页',
            'Photo'=>'相册',
            'Selfform'=>'万能表单',
            'Host'=>'商家订单',
            'Groupon'=>'团购',
            'Shop'=>'商城',
            'Repast'=>'订餐',
            'Wedding'=>'婚庆喜帖',
            'Vote'=>'投票',
            'Panorama'=>'全景',
            'Lottery'=>'大转盘',
            'Guajiang'=>'刮刮卡',
            'Coupon'=>'优惠券',
            'MemberCard'=>'会员卡',
            'Estate'=>'微房产',
            'Message'=>'留言板',
            'Car'=>'汽车',
            'GoldenEgg'=>'砸金蛋',
            'LuckyFruit'=>'水果机',
            'AppleGame'=>'走鹊桥',
            'Lovers'=>'摁死情侣',
            'Autumn'=>'吃月饼',
            'Problem'=>'一战到底',
            'Forum'=>'论坛',
            'GreetingCard'=>'贺卡',
            'Medical'=>'微医疗',
            'School'=>'微教育',
            'Hotels'=>'酒店宾馆',
            'Business'=>'行业应用',
            'Market'=>'微商圈',
            'Research'=>'微调研',
            'Fansign'=>'微信签到',
            'Shake'=>'摇一摇',
            'Jiugong'=>'九宫格',
            'OutsideLink'=>'<font color="red">生活服务</font>',
        );
        $this->arr =array(0 => 'game',  1 => 'Invite',  2 => 'Red_packet',  3 => ' Seckill', 4 => 'Autumns', 5 => 'Popularity',  6 => 'Helping', 7 => 'Jiugong', 8 => 'MicroBroker', 9 => 'Crowdfunding',   10 => 'Unitary', 11 => 'DishOut',   12 => 'Bargain', 13 => 'SeniorScene', 14 => 'Test', 15 => 'Service', 16 => 'Hongbao', 17 => 'SeniorCard', 18 => 'Seckill', 19 => 'ServiceChat', 20 => 'Voteimg', 21 => 'Micrstore', 22 => 'Person_card', 23 => 'Cutprice', 24 => 'Punish', 25 => 'Numqueue',);

       // $dbconn=array( "host"=>'103.7.222.41', "user"=>'b2ctest', "pass"=>'B2@c@2tE8T', "name"=>'qiyuedb',);
        //$this->db = new Lxdb( $dbconn);

       if(C('server_topdomain')=='pigcms.cn'){
            //demo settings
            $this->arr = array('game','Invite','Red_packet', 'Seckill','Autumns','Popularity','Helping','Jiugong','MicroBroker','Crowdfunding',"Unitary","DishOut","LivingCircle","Test","Bargain","Service","Hongbao","Micrstore","SeniorScene","SeniorCard","ServiceChat","Voteimg","Cutprice","Person_card","Numqueue","Punish");
        }else{
            if(!is_file(RUNTIME_PATH.'function_library.php')){
                updateSync::sync_function_library();
            }
             }

    } */

    public  function  __construct(){
        $urlhost = empty($_SERVER["SERVER_NAME"])?$_SERVER["HTTP_HOST"]:$_SERVER["SERVER_NAME"];
        if($urlhost == 'kaifa.zq.zhongsou.com' || $urlhost=='zq.zhongsou.com'){
            $this->dbconn = array( "host"=>'103.7.222.62', "user"=>'root', "pass"=>'zhs20151117', "name"=>'qiyuedb_new');
            $this->db2conn = array( "host"=>'103.7.222.62', "user"=>'root', "pass"=>'zhs20151117', "name"=>'zqtest');
            $this->vqurl='http://kaifa.vq.zhongsou.com/';
        }else{
            $this->dbconn = array( "host"=>'103.7.222.41', "user"=>'b2ctest', "pass"=>'B2@c@2tE8T', "name"=>'qiyuedb');
            $this->db2conn = array( "host"=>'103.7.222.31', "user"=>'qyer', "pass"=>'qYf2^8L!ne', "name"=>'qiyueII');
            $this->vqurl='http://vq.zhongsou.com/';
        }

        $this->token= $_SESSION["userinfo"]['token'];
    }


    public  function index(){
         
        $this->db = new Lxdb($this->dbconn);
        $reuult = $this->db->arrdata( $select="*",'tp_function',$where="where isshow = 1 and showtouser = 1");
        $version =array(
            'Restaurant'=>'5', //餐饮
            'estate'=>'8', //房产
            'ktv'=>'10',//ktv版
            'DishOut'=>'',//外卖
            'hotel'=>'3',//酒店
            'Hotels_1'=>'15',//酒店1.0
//'2' => '普通版',
//'3' => '酒店版',
//    //   '4' => '餐饮版',
//'5' => '餐饮版',
//'6' => '商城版',
//'7' => '教育版',
//'8' => '房产版',
//'9' => '汽车版',
//'10' => 'KTV版',
//'11' => '美容版',
//'12' => '宠物版',
//'13' => '食品版',
//'14' => '物业版'
        );   //行业版本 qy_user中hytype有对应用户购买行业版本ID

        $token = $this->token;

        $this->db2 = new Lxdb( $this->db2conn);
        $info = $this->db2->arrdata("*",'qy_users', "where  token = '$token' ");

        $info2 = explode(',',$info[0]['hytype']);  //用户购买到的行业版ID


        $result = $this->db->arrdata( "*",'tp_function',"where isshow = 1 and showtouser = 1");
       // $result=    M('function')->where("isshow = 1 and showtouser = 1")->select();
        foreach($result as $key =>$val){
            if($val['classid'] == "9"){
                if(!in_array($version[$val["funname"]],$info2)){
                    unset($result[$key]);
                }
            }
        }

        $data = array();
        $data['token'] = $_SESSION["userinfo"]['token'];

        if($result){
            $data['status'] = 1;
            $data['msg'] = $result;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }

    /**
     * 获取中文首写字母
     * @param String $string
     * @return string|Ambigous <string>
     */
    private function _getFirstCharter($string) {
        if (empty($string)) {
            return '';
        }
        $fchar = ord($string{0});
        if ($fchar >= ord('A') && $fchar <= ord('z')) {
            return strtoupper($string{0});
        }
        $s1 = iconv ( 'UTF-8', 'gb2312', $string );
        $s2 = iconv ( 'gb2312', 'UTF-8', $s1 );
        $s = $s2 == $string ? $s1 : $string;
        $asc = ord($s{0}) * 256 + ord($s{1}) - 65536;
        if ($asc >= -20319 && $asc <= -20284) return 'A';
        if ($asc >= -20283 && $asc <= -19776) return 'B';
        if ($asc >= -19775 && $asc <= -19219) return 'C';
        if ($asc >= -19218 && $asc <= -18711) return 'D';
        if ($asc >= -18710 && $asc <= -18527) return 'E';
        if ($asc >= -18526 && $asc <= -18240) return 'F';
        if ($asc >= -18239 && $asc <= -17923) return 'G';
        if ($asc >= -17922 && $asc <= -17418) return 'H';
        if ($asc >= -17417 && $asc <= -16475) return 'J';
        if ($asc >= -16474 && $asc <= -16213) return 'K';
        if ($asc >= -16212 && $asc <= -15641) return 'L';
        if ($asc >= -15640 && $asc <= -15166) return 'M';
        if ($asc >= -15165 && $asc <= -14923) return 'N';
        if ($asc >= -14922 && $asc <= -14915) return 'O';
        if ($asc >= -14914 && $asc <= -14631) return 'P';
        if ($asc >= -14630 && $asc <= -14150) return 'Q';
        if ($asc >= -14149 && $asc <= -14091) return 'R';
        if ($asc >= -14090 && $asc <= -13319) return 'S';
        if ($asc >= -13318 && $asc <= -12839) return 'T';
        if ($asc >= -12838 && $asc <= -12557) return 'W';
        if ($asc >= -12556 && $asc <= -11848) return 'X';
        if ($asc >= -11847 && $asc <= -11056) return 'Y';
        if ($asc >= -11055 && $asc <= -10247) return 'Z';
        $undefined = array('8460'=>'E'); //自定义
        return empty($undefined[abs($asc)]) ? '#' : $undefined[abs($asc)];
    }

    /*
     * 分组排序，计算每列的数量
     * @param Array $modules
     * @return Array
     */
    private function _getModules($modules) {
        $key = array();
        foreach ($modules as $value) {
            $en =  $this->_getFirstCharter(strip_tags($value['name']));
            $array[$en.'000'] = $en;
            $num = str_pad(++$key[$en], 3, '0', STR_PAD_LEFT);
            $array[$en.$num] = $value;
        }
        // count($key)
        $count =  count($array);
        for ($i = 3; $i > 0; $i--) {
            $group[$i] = ceil($count / $i);
            $count = $count - $group[$i];
        }
        rsort($group);
        ksort($array);
        $i = 1; $k=0; $en = 0;
        foreach ($array as $key => $value) {
            $count = $group[$k];
            $i++;
            $result[$k][$key] = $value;
            if ($i > $count) {
                $k++;
                $i=1;
            }
        }
        return $result;
    }

    public function insert(){
        if ($_GET['iskeyword']){
            $modules=$this->keywordModules();
        }else {
            $modules=$this->modules();
        }

        // return  $this->_getModules($modules);
        $info = $this->_getModules($modules);
        //var_dump($info['0']);exit;
        $this->smarty->assign('modules1',$info[0]);
        $this->smarty->assign('modules2',$info[1]);
        $this->smarty->assign('modules3',$info[2]);
        $this->smarty->assign('iskeyword',$_GET['iskeyword']);
        $this->smarty->display("link_insert.tpl");
    }
    public function keywordModules(){

        $school=M('School_set_index')->where(array('token'=>$this->token))->find();
        $t=array(
            array('module'=>'Home','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>'微站首页','sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>$this->modules['Home'],'askeyword'=>1),
            array('module'=>'Img','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=content&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Img'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Company','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Company&a=map&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Company'],'canselected'=>1,'linkurl'=>'','keyword'=>'地图','askeyword'=>1),
            array('module'=>'Photo','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Photo&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Photo'],'canselected'=>1,'linkurl'=>'','keyword'=>'相册','askeyword'=>1),
            array('module'=>'Live','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Live&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Live'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Selfform','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Selfform&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Selfform'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Host','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Host&a=detail&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Host'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Groupon','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Groupon&a=grouponIndex&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Groupon'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'团购','askeyword'=>1),
            array('module'=>'Shop','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Store&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Shop'],'canselected'=>1,'linkurl'=>'','keyword'=>'商城','askeyword'=>1),
            array('module'=>'Repast','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Repast&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Repast'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'订餐','askeyword'=>1),
            array('module'=>'Wedding','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Wedding&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Wedding'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Vote','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Vote&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Vote'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Panorama','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Panorama&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Panorama'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>$this->modules['Panorama'],'askeyword'=>1),
            array('module'=>'Lottery','linkcode'=>'','name'=>$this->modules['Lottery'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Guajiang','linkcode'=>'','name'=>$this->modules['Guajiang'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Coupon','linkcode'=>'','name'=>$this->modules['Coupon'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'AppleGame','linkcode'=>'','name'=>$this->modules['AppleGame'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Lovers','linkcode'=>'','name'=>$this->modules['Lovers'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Autumn','linkcode'=>'','name'=>$this->modules['Autumn'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Problem','linkcode'=>'','name'=>$this->modules['Problem'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'MemberCard','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Card&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['MemberCard'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'会员卡','askeyword'=>1),
            array('module'=>'Estate','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Estate'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Message','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Reply&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Message'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'留言','askeyword'=>1),
            array('module'=>'Car','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Car&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Car'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'汽车','askeyword'=>1),
            array('module'=>'GoldenEgg','linkcode'=>'','name'=>$this->modules['GoldenEgg'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'LuckyFruit','linkcode'=>'','name'=>$this->modules['LuckyFruit'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Forum','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Forum&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Forum'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'论坛','askeyword'=>1),
            array('module'=>'Hotels','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Hotels&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>'酒店宾馆','sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'酒店','askeyword'=>1),
            array('module'=>'School','linkcode'=>'','name'=>$this->modules['School'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>$school['keyword'],'askeyword'=>1),
            //array('module'=>'GreetingCard','linkcode'=>'','name'=>$this->modules['GreetingCard'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Business','linkcode'=>'','name'=>$this->modules['Business'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),

            array('module'=>'Market','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Market&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Market'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'微商圈','askeyword'=>1),
            array('module'=>'Research','linkcode'=>'','name'=>$this->modules['Research'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Fansign','linkcode'=>'','name'=>'微信签到','sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'微信签到','askeyword'=>1),
            array('module'=>'Shake','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Shake&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Shake'],'canselected'=>1,'linkurl'=>'','keyword'=>'摇一摇','askeyword'=>1),
            array('module'=>'GreetingCard','linkcode'=>'','name'=>$this->modules['GreetingCard'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Jiugong','linkcode'=>'','name'=>$this->modules['Jiugong'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
        );

        //
        $sub=isset($_GET['sub'])?intval($_GET['sub']):0;
        foreach ($this->arr as $ka){
            $className='FunctionLibrary_'.$ka;
            if (class_exists($className)){
                $classInstance=new $className($this->token,$sub);
                $o=$classInstance->index();
                $canselected=$o['keyword']?1:0;
                $s=array('module'=>$ka,'linkcode'=>'','name'=>$o['name'],'sub'=>$o['subkeywords'],'canselected'=>$canselected,'linkurl'=>'?g=User&m=Link&a=commondetail&module='.$ka.'&iskeyword=1','keyword'=>$o['keyword'],'askeyword'=>1);
                array_push($t,$s);
            }
        }
        return $t;
    }
    public function commondetail(){

        $sub=isset($_GET['sub'])?intval($_GET['sub']):1;
        $className='FunctionLibrary_'.$this->_get('module');
        if (class_exists($className)){
            $classInstance=new $className($this->token,$sub);
            $o=$classInstance->index();
            /*
            $canselected=$o['keyword']?1:0;
            $s=array('module'=>$ka,'linkcode'=>'','name'=>$o['name'],'sub'=>$o['subkeywords'],'canselected'=>$canselected,'linkurl'=>'?g=User&m=Link&a=commondetail&module='.$ka.'&iskeyword=1','keyword'=>$o['keyword'],'askeyword'=>1);
            */

             $this->smarty->assign('moduleName',$o['name']);
            $fromitems=intval($_GET['iskeyword'])?$o['subkeywords']:$o['sublinks'];
            $items=array();
            if ($fromitems){
                $i=0;
                foreach ($fromitems as $item){
                    array_push($items,array('id'=>$i,'name'=>$item['name'],'linkcode'=>$item['link'],'linkurl'=>'','keyword'=>$item['keyword']));
                }
            }

        }

         $this->smarty->assign('list',$items);
         //$this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.link');
    }
    public function modules(){
        $t=array(
            array('module'=>'Home','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>'微站首页','sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>$this->modules['Home'],'askeyword'=>1),
            array('module'=>'Classify','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=lists&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Classify'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>0),
            array('module'=>'Img','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=content&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Img'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Company','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Company&a=map&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Company'],'sub'=>1,'canselected'=>1,'linkurl'=>'','keyword'=>'地图','askeyword'=>1),
            array('module'=>'Adma','linkcode'=>$this->vqurl.'index.php/show/'.$this->token,'name'=>$this->modules['Adma'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'','askeyword'=>0),
            array('module'=>'Photo','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Photo&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Photo'],'sub'=>1,'canselected'=>1,'linkurl'=>'','keyword'=>'相册','askeyword'=>1),
            array('module'=>'Live','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Live&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Live'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Selfform','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Custom&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Selfform'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Host','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Host&a=detail&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Host'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Groupon','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Groupon&a=grouponIndex&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Groupon'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'团购','askeyword'=>1),
            array('module'=>'Shop','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Store&a=select&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Shop'],'sub'=>1,'canselected'=>1,'linkurl'=>'','keyword'=>'商城','askeyword'=>1),
            array('module'=>'ShopCats','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Store&a=select&token='.$this->token.'&wecha_id={wechat_id}','name'=>'商城分类','sub'=>1,'canselected'=>1,'linkurl'=>'','keyword'=>'商城','askeyword'=>0),
            array('module'=>'Repast','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Repast&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Repast'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'订餐','askeyword'=>1),
            array('module'=>'Wedding','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Wedding&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Wedding'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Vote','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Vote&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Vote'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Paper','linkcode'=> $this->vqurl.'index.php?g=Wap&m=Paper&a=index&token=' . $this->token.'&wecha_id={wechat_id}', 'name' => $this->modules['Paper'], 'sub' => 1, 'canselected' => 0, 'linkurl' => '', 'keyword' => '', 'askeyword' => 1),
            array('module'=>'Panorama','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Panorama&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Panorama'],'sub'=>1,'canselected'=>1,'linkurl'=>'','keyword'=>$this->modules['Panorama'],'askeyword'=>1),
            array('module'=>'Lottery','linkcode'=>'','name'=>$this->modules['Lottery'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Guajiang','linkcode'=>'','name'=>$this->modules['Guajiang'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Coupon','linkcode'=>'','name'=>$this->modules['Coupon'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'AppleGame','linkcode'=>'','name'=>$this->modules['AppleGame'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Lovers','linkcode'=>'','name'=>$this->modules['Lovers'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Autumn','linkcode'=>'','name'=>$this->modules['Autumn'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Problem','linkcode'=>'','name'=>$this->modules['Problem'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'MemberCard','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Card&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['MemberCard'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'会员卡','askeyword'=>1),
            array('module'=>'Estate','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Estate'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'微房产','askeyword'=>0),
            array('module'=>'Message','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Reply&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Message'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'留言','askeyword'=>1),
            array('module'=>'Car','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Car&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Car'],'sub'=>1,'canselected'=>1,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Medical','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Medical&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Medical'],'sub'=>1,'canselected'=>1,'linkurl'=>'','keyword'=>'微医疗','askeyword'=>0),
            array('module'=>'School','linkcode'=>$this->vqurl.'index.php?g=Wap&m=School&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['School'],'sub'=>1,'canselected'=>1,'linkurl'=>'','keyword'=>'微医疗','askeyword'=>0),
            array('module'=>'GoldenEgg','linkcode'=>'','name'=>$this->modules['GoldenEgg'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'LuckyFruit','linkcode'=>'','name'=>$this->modules['LuckyFruit'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Forum','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Forum&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Forum'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'论坛','askeyword'=>1),
            //array('module'=>'GreetingCard','linkcode'=>'','name'=>$this->modules['GreetingCard'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Hotels','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Hotels&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>'酒店宾馆','sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'酒店','askeyword'=>1),
            array('module'=>'Business','linkcode'=>'','name'=>$this->modules['Business'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'Market','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Market&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Market'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'','askeyword'=>0),
            array('module'=>'Research','linkcode'=>'','name'=>$this->modules['Research'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>0),
            array('module'=>'Fansign','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Fanssign&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Fansign'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'','askeyword'=>0),
            array('module'=>'OutsideLink','linkcode'=>'','name'=>$this->modules['OutsideLink'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>0),
            array('module'=>'Shake','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Shake&a=index&token='.$this->token.'&wecha_id={wechat_id}','name'=>$this->modules['Shake'],'canselected'=>1,'linkurl'=>'','keyword'=>'摇一摇','askeyword'=>1),
            array('module'=>'GreetingCard','linkcode'=>'','name'=>$this->modules['GreetingCard'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
            array('module'=>'jiugong','linkcode'=>'','name'=>$this->modules['jiugong'],'sub'=>1,'canselected'=>0,'linkurl'=>'','keyword'=>'','askeyword'=>1),
        );

        $sub=isset($_GET['sub'])?intval($_GET['sub']):0;
        foreach ($this->arr as $ka){
            $className='FunctionLibrary_'.$ka;
            if (class_exists($className)){
                $classInstance=new $className($this->token,$sub);
                $o=$classInstance->index();
                $canselected=$o['link']?1:0;
                $s=array('module'=>$ka,'linkcode'=>$o['link'],'name'=>$o['name'],'sub'=>$o['sublinks'],'canselected'=>$canselected,'linkurl'=>'?g=User&m=Link&a=commondetail&module='.$ka.'&iskeyword=0','keyword'=>$o['keyword'],'askeyword'=>0);
                array_push($t,$s);
            }
        }

        return $t;
    }
    public function Classify(){
        $pid = (int)$_GET['pid'];
         $this->smarty->assign('moduleName',$this->modules['Classify']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_classify',$where="where fid='$pid' and 'token' = '$token' ");
        //$db=M('Classify');
      //  $where=$this->where;


//        if($pid != NULL){
//            $where['fid'] = $pid;
//            $count      = $db->where($where)->count();
//            $Page       = new Page($count,10);
//            $show       = $Page->show();
//            $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
//        }else{
//            $where['fid'] = 0;
//            $count      = $db->where($where)->count();
//            $Page       = new Page($count,10);
//            $show       = $Page->show();
//
//            $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
//        }

        $items=array();
        if ($list){
            foreach ($list as $k=>$item){
                $fid = $item['id'];
                array_push($items,array('id'=>$item['id'],'name'=>$item['name'],'sublink'=>'?g=User&m=Link&a=Classify&iskeyword=0&pid='.$item['id'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=lists&token='.$token.'&classid='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword'],'sub'=>$this->db->arrdata( $select="id,name",'tp_classify',$where="where fid='$pid' and 'token' = '$token' ") ));
            }
        }
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;

         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Home(){
        //笨方法，，直接可以选择数组写好，不查询，
        $token = $_SESSION['userinfo']['token'];
        $items = array();
         array_push($items, array('module'=>'Home','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=index&token='.$token,'name'=>'微站首页','sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>$this->modules['Home'],'askeyword'=>1));

        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;

    }

    public function  Message(){

        $token = $_SESSION['userinfo']['token'];
        $items = array();
        array_push($items, array('module'=>'Message','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Reply&a=index&token='.$token ,'name'=>$this->modules['Message'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'留言','askeyword'=>1));


        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }
     public function Forum(){
         $token = $_SESSION['userinfo']['token'];
         $items = array();
         array_push($items, array('module'=>'Forum','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Forum&a=index&token='.$token,'name'=>$this->modules['Forum'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'论坛','askeyword'=>1));

         if($items){
             $data['status'] = 1;
             $data['item'] = $items;
         }else{
             $data['status'] = 0;
         }
         echo json_encode($data);exit;

     }

    public function  Reply(){

        $token = $_SESSION['userinfo']['token'];
        $items = array();
        array_push($items, array('module'=>'Message','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Reply&a=index&token='.$token,'name'=>$this->modules['Message'],'sub'=>0,'canselected'=>1,'linkurl'=>'','keyword'=>'留言','askeyword'=>1));


        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }
    public function Img(){

         $this->smarty->assign('moduleName',$this->modules['Img']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_img',$where=" where  token = '$token' ");
//        $db=M('Img');
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=content&token='.$token.'&id='.$item['id'],'keyword'=>$item['keyword']));
            }
        }
        //

        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Live(){
         $this->smarty->assign('moduleName',$this->modules['Live']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_live',$where="where  token = '$token' ");

//        $db=M('Live');
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['name'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Live&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //

        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;

         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Company(){
         $this->smarty->assign('moduleName',$this->modules['Company']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_company',$where="where  token = '$token' ");

        // $db=M('Company');
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['name'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Company&a=map&token='.$token.'&companyid='.$item['id'],'linkurl'=>'','keyword'=>'地图'));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Photo(){
         $this->smarty->assign('moduleName',$this->modules['Photo']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_photo',$where="where  token = '$token' ");
//        $db=M('Photo');
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Photo&a=plist&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>'相册'));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Selfform(){
         $this->smarty->assign('moduleName',$this->modules['Selfform']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_custom_set',$where="where  token = '$token' ");

//        $db=M('Custom_set');
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('set_id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['set_id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Custom&a=index&token='.$token.'&id='.$item['set_id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Custom(){
         $this->smarty->assign('moduleName', $this->modules['Selfform']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_custom_set',$where="where  token = '$token' ");

//        $db    = M('Custom_set');
//        $where = $this->where;
//        $count = $db->where($where)->count();
//        $Page  = new Page($count, 5);
//        $show  = $Page->show();
//        $list  = $db->where($where)->limit($Page->firstRow . ',' . $Page->listRows)->order('set_id DESC')->select();
        //
        $items = array();

        if ($list) {
            foreach ($list as $item) {
                array_push($items, array('id' => $item['set_id'],'name' => $item['title'],'linkcode' => $this->vqurl.'index.php?g=Wap&m=Custom&a=index&token=' . $this->token . '&id=' . $item['set_id'],'linkurl' => '','keyword' => $item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list', $items);
         $this->smarty->assign('page', $show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Host(){
        $moduleName='Host';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_host',$where="where  token = '$token' ");

//        $db=M($moduleName);
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['name'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Host&a=index&token='.$token.'&hid='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
         //$this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Panorama(){
         $this->smarty->assign('moduleName',$this->modules['Panorama']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_panorama',$where="where token = '$token' ");

//        $db=M('Panorama');
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('time DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['name'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Panorama&a=item&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Wedding(){
        $moduleName='Wedding';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_wedding',$where="where  token = '$token' ");

//        $db=M($moduleName);
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Wedding&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
         //$this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Lottery(){
        $moduleName='Lottery';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_lottery',$where="where type = 1 and token = '$token' ");
       // $db=M($moduleName);
        //$where=$this->where;
        //$where['type']=1;
       // $count      = $db->where($where)->count();
       // $Page       = new Page($count,5);
       // $show       = $Page->show();
       // $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();

        //

        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Lottery&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }

        //
        if($list){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function AppleGame(){
        $moduleName='AppleGame';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_lottery',$where="where type = 7 and token = '$token' ");
//        $db=M('Lottery');
//        $where=$this->where;
//        $where['type']=7;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=AppleGame&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Lovers(){
        $moduleName='Lovers';
        $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_lottery',$where="where type = 8 and token = '$token' ");

//        $db=M('Lottery');
//        $where=$this->where;
//        $where['type']=8;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Lovers&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }

    public function Problem(){
        $moduleName='Problem';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_problem_game',$where="where token = '$token' ");
//        $db=M('Problem_game');
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['name'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Problem&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
         //$this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Guajiang(){
        $moduleName='Guajiang';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_lottery',$where="where type = 2 and token = '$token' ");

//        $db=M('Lottery');
//        $where=$this->where;
//        $where['type']=2;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Guajiang&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Coupon(){
        $moduleName='Coupon';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_lottery',$where="where type = 3 and token = '$token' ");
//        $db=M('Lottery');
//        $where=$this->where;
//        $where['type']=3;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Coupon&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function LuckyFruit(){
        $moduleName='LuckyFruit';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_lottery',$where="where type = 4 and token = '$token' ");

//        $db=M('Lottery');
//        $where=$this->where;
//        $where['type']=4;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=LuckyFruit&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function GoldenEgg(){
        $moduleName='GoldenEgg';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_lottery',$where="where type = 5 and token = '$token' ");
//        $db=M('Lottery');
//        $where=$this->where;
//        $where['type']=5;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //echo $db->getLastSql();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=GoldenEgg&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
         //$this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Research(){
        $moduleName='Research';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_research',$where="where  token = '$token' ");
//        $db=M('Research');
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Research&a=index&token='.$token.'&reid='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
         //$this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function GreetingCard(){
        $moduleName='GreetingCard';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_greeting_card',$where="where type = 5 and token = '$token' ");

//        $db=M('greeting_card');
//        $where=$this->where;
//        //$where['type']=5;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Greeting_card&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
       //  $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Vote(){
        $moduleName='Vote';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];
        $list = $this->db->arrdata( $select="*",'tp_vote',$where="where  token = '$token' ");

//        $db=M($moduleName);
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Vote&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Shop(){
        $moduleName='Shop';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_company',$where="where display='1' and 'token'= '$token' ");

//        $db=M('Company');
//        $where=array('display'=>1,'token'=>$this->token);
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        //http://cms.xingboke.com/index.php?g=Wap&m=Store&a=cats&token=yicms&wecha_id=oLA6VjlHpnWSNuak_YchHaCUCMwg&cid=6
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['name'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Store&a=cats&token='.$token.'&cid='.$item['id'],'linkurl'=>'','keyword'=>'商城'));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function ShopCats(){
        $moduleName='Shop';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_product_cat',$where="where 'dining'=0 and 'token'= '$token' ");

//        $db=M('Product_cat');
//        $where=array('dining'=>0,'token'=>$this->token);
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('id DESC')->select();
        //
        //http://cms.xingboke.com/index.php?g=Wap&m=Store&a=cats&token=yicms&wecha_id=oLA6VjlHpnWSNuak_YchHaCUCMwg&cid=6
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['name'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Store&a=products&token='.$token.'&catid='.$item['id'],'linkurl'=>'','keyword'=>'商城'));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }
    public function Estate(){
        $moduleName='Estate';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $Estates = $this->db->arrdata( $select="*",'tp_estate',$where="where token = '$token' ");

        //  $Estates=M('Estate')->where($this->where)->select();
        //
        $items=array();
        if ($Estates){
            foreach ($Estates as $e){
                array_push($items,array('id'=>$e['id'],'name'=>$e['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=index&token='.$token.'&id='.$e['id'],'linkurl'=>'','keyword'=>$e['keyword'],'sub'=>1,'sublink'=>'/index.php?g=User&m=Link&a=EstateDetail&token='.$token.'&id='.$e['id']));
            }
        }
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;

         $this->smarty->assign('list',$items);
         $this->smarty->display('link_detail.tpl');
        /*
        $moduleName='Estate';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        //
        $items=array();
        array_push($items,array('id'=>1,'name'=>'楼盘介绍','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=index&token='.$this->token.'&wecha_id={wechat_id}','linkurl'=>'','keyword'=>'微房产'));
        array_push($items,array('id'=>2,'name'=>'楼盘相册','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=album&token='.$this->token.'&wecha_id={wechat_id}','linkurl'=>'','keyword'=>'微房产'));
        array_push($items,array('id'=>3,'name'=>'户型全景','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=housetype&token='.$this->token.'&wecha_id={wechat_id}','linkurl'=>'','keyword'=>'微房产'));
        array_push($items,array('id'=>4,'name'=>'专家点评','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=impress&token='.$this->token.'&wecha_id={wechat_id}','linkurl'=>'','keyword'=>'微房产'));
        $Estate=M('Estate')->where(array('token'=>$this->token))->find();
        $rt=M('Reservation')->where(array('id'=>$Estate['res_id']))->find();
        array_push($items,array('id'=>5,'name'=>'看房预约','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Reservation&a=index&rid='.$Estate['res_id'].'&token='.$this->token.'&wecha_id={wechat_id}','linkurl'=>'','keyword'=>$rt['keyword']));
         $this->smarty->assign('list',$items);
         $this->smarty->display('link_detail.tpl');
        */
    }
    public function EstateDetail(){
        $moduleName='Estate';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $id=intval($_GET['id']);
        //
        $items=array();
        array_push($items,array('id'=>1,'name'=>'楼盘介绍','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=index&token='.$this->token.'&id='.$id,'linkurl'=>'','keyword'=>'微房产'));
        array_push($items,array('id'=>2,'name'=>'楼盘相册','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=album&token='.$this->token.'&id='.$id,'linkurl'=>'','keyword'=>'微房产'));
        array_push($items,array('id'=>3,'name'=>'户型全景','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=housetype&token='.$this->token.'&id='.$id,'linkurl'=>'','keyword'=>'微房产'));
        array_push($items,array('id'=>4,'name'=>'专家点评','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Estate&a=impress&token='.$this->token.'&id='.$id,'linkurl'=>'','keyword'=>'微房产'));
        $Estate=M('Estate')->where(array('token'=>$this->token,'id'=>$id))->find();
        $rt=M('Reservation')->where(array('id'=>$Estate['res_id']))->find();
        array_push($items,array('id'=>5,'name'=>'看房预约','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Reservation&a=index&rid='.$Estate['res_id'].'&token='.$this->token.'&id='.$id,'linkurl'=>'','keyword'=>$rt['keyword']));

        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
         $this->smarty->display('link_detail.tpl');
    }
    public function Car(){
        $moduleName='Car';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $thisItem = $this->db->arrdata( $select="*",'tp_carset',$where="where  token = '$token' ");
         $thisItemNews = $this->db->arrdata( $select="*",'tp_carnews',$where="where token = '$token' ");

        //
       // $thisItem=M('Carset')->where(array('token'=>$this->token))->find();
        //$thisItemNews=M('Carnews')->where(array('token'=>$this->token))->find();
        $items=array();
        array_push($items,array('id'=>1,'name'=>'经销车型','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Car&a=brands&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>2,'name'=>'销售顾问','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Car&a=salers&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>3,'name'=>'车主关怀','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Car&a=owner&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>4,'name'=>'车型欣赏','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Car&a=showcar&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>5,'name'=>'实用工具','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Car&a=tool&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>6,'name'=>'预约试驾','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Car&a=CarReserveBook&addtype=drive&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>7,'name'=>'预约保养','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Car&a=CarReserveBook&addtype=maintain&token='.$token.'&wecha_id={wechat_id}','linkurl'=>'','keyword'=>$thisItem['keyword']));
        //
        array_push($items,array('id'=>8,'name'=>'最新车讯','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=lists&classid='.$thisItemNews['news_id'].'&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>9,'name'=>'最新优惠','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=lists&classid='.$thisItemNews['pre_id'].'&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>10,'name'=>'尊享二手车','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Index&a=lists&classid='.$thisItemNews['usedcar_id'].'&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>11,'name'=>'品牌相册','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Photo&a=plist&id='.$thisItemNews['album_id'].'&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>12,'name'=>'店铺LBS','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Company&a=map&companyid='.$thisItemNews['company_id'].'&token='.$token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
         $this->smarty->display('link_detail.tpl');
    }
    public function Medical(){
        $moduleName='Medical';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_lottery',$where="where type = 9 and token = '$token' ");

        //
      //  $thisItem=M('Medical_set')->where(array('token'=>$this->token))->find();
        //$thisItemNews=M('Carnews')->where(array('token'=>$this->token))->find();
        $items=array();
        array_push($items,array('id'=>1,'name'=>'医院简介','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Medical&a=Introduction&token='.$this->token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>2,'name'=>'热点聚焦','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Medical&a=publicListTmp&type=hotfocus&token='.$this->token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>3,'name'=>'医院专家','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Medical&&a=publicListTmp&type=experts&token='.$this->token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>4,'name'=>'尖端设备','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Medical&a=publicListTmp&type=equipment&token='.$this->token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>5,'name'=>'康复案例','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Medical&a=publicListTmp&type=rcase&token='.$this->token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>6,'name'=>'先进技术','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Medical&&a=publicListTmp&type=technology&token='.$this->token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>6,'name'=>'研发药物','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Medical&&a=publicListTmp&type=drug&token='.$this->token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>6,'name'=>'预约挂号','linkcode'=>$this->vqurl.'index.php?g=Wap&m=Medical&&a=registered&token='.$this->token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
         $this->smarty->display('link_detail.tpl');
    }
    public function School(){
        $moduleName='School';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $thisItem = $this->db->arrdata( $select="*",'tp_medical_set',$where="where  token = '$token' ");
        $thisItemNews = $this->db->arrdata( $select="*",'tp_carnews',$where="where  token = '$token' ");
        //
       // $thisItem=M('Medical_set')->where(array('token'=>$this->token))->find();
        //$thisItemNews=M('Carnews')->where(array('token'=>$this->token))->find();
        $items=array();
        array_push($items,array('id'=>1,'name'=>'成绩查询','linkcode'=>$this->vqurl.'index.php?g=Wap&m=School&a=qresults&token='.$this->token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        array_push($items,array('id'=>1,'name'=>'食谱列表','linkcode'=>$this->vqurl.'index.php?g=Wap&m=School&a=public_list&type=school&token='.$this->token,'linkurl'=>'','keyword'=>$thisItem['keyword']));
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
         $this->smarty->display('link_detail.tpl');
    }

//外链小工具

    public function OutsideLink(){
        //处理小工具数组文件
        $f = include('./PigCms/Lib/ORG/Func.links.php');
        //取出分类总汇
        $i=0;
        foreach ($f['func'] as $k=>$v){

            $list[$i]['name'] = $v;
            $list[$i]['code'] = $k;
            $i++;
        }

         $this->smarty->assign('list',$list);
         $this->smarty->display();
    }

    public function outsideLinkDetail(){
        $c = $this->_get('c');

        $f = include('./PigCms/Lib/ORG/Func.links.php');

        $list = $f[$c];
         $this->smarty->assign('list',$list);
         $this->smarty->display('OutsideLink');

    }
    public function Autumn(){
        $moduleName='Autumn';
         $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_lottery',$where="where type = 9 and token='$token' ");

        //$db=M('Lottery');
//        $where=$this->where;
//        $where['type']=9;
//        $count      = $this->db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
        //$list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows-)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Autumn&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }

    public function Jiugong(){
        $moduleName='Jiugong';
        $this->smarty->assign('moduleName',$this->modules[$moduleName]);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_lottery',$where="where type = 10 and token='$token' ");

        //$db=M('Lottery');
//        $where=$this->where;
//        $where['type']=9;
//        $count      = $this->db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
        //$list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows-)->order('id DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Jiugong&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
        $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
        $this->smarty->display('link_detail.tpl');
    }

    public function  helping(){
    $this->db = new Lxdb($this->dbconn);
    $token = $_SESSION['userinfo']['token'];

    $list = $this->db->arrdata( $select="*",'tp_helping',$where="where  token='$token' ");

    $items=array();
    if ($list){
        foreach ($list as $item){
            array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Helping&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
        }
    }
    //
    if($items){
        $data['status'] = 1;
        $data['item'] = $items;
    }else{
        $data['status'] = 0;
    }
    echo json_encode($data);exit;
}

    //拆礼盒
    public function  Autumns(){
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_activity',$where="where  type =1 and token='$token' ");

        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Autumns&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }

    //人气冲榜
    public function  Popularity(){
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_popularity',$where="where  token='$token' ");

        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Popularity&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }

    //图文投票
    public function  Voteimg(){
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_voteimg',$where="where  token='$token' ");

        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['action_name'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Voteimg&a=index&token='.$token.'&id='.$item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }

    public function Business(){
         $this->smarty->assign('moduleName',$this->modules['Business']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_busines',$where="where  token = '$token' ");
//        $db=M('Busines');
//        $where=$this->where;
//        $count      = $db->where($where)->count();
//        $Page       = new Page($count,5);
//        $show       = $Page->show();
//        $list=$db->where($where)->limit($Page->firstRow.','.$Page->listRows)->order('bid DESC')->select();
        //
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('bid'=>$item['bid'],'name'=>$item['mtitle'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Business&a=index&token='.$token.'&bid='.$item['bid'].'&type='.$item['type'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list',$items);
        // $this->smarty->assign('page',$show);
         $this->smarty->display('link_detail.tpl');
    }

    public  function Shake(){
//        $token = $_SESSION['token'];
//        $list = M('shake')->where("token='$token'")->select();

        $this->smarty->assign('moduleName',$this->modules['Business']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_shake',$where="where  token = '$token' ");

        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Shake&a=index&token='.$token.'&id='.$item['id'].'&act_type=2','keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }

    //签到
    public  function  Signin(){
//        $token = $_SESSION['token'];
//        $list = M('sign_set')->where("token='$token'")->select();
        $this->smarty->assign('moduleName',$this->modules['Business']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_sign_set',$where="where  token = '$token' ");

        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Fanssign&a=index&token='.$token.'&id='.$item['id'],'keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }

    //微信墙
    public  function Wall(){
//        $token = $_SESSION['token'];
//        $list = M('wall')->where("token='$token'")->select();
        $this->smarty->assign('moduleName',$this->modules['Business']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_wall',$where="where  token = '$token' ");

        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Wall&a=index&token='.$token.'&id='.$item['id'],'keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }
    //微信红包
    public  function  Red_packet(){
//        $token = $_SESSION['token'];
//        $list = M('red_packet')->where("token='$token'")->select();
        $this->smarty->assign('moduleName',$this->modules['Business']);
        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( $select="*",'tp_red_packet',$where="where  token = '$token' ");
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Red_packet&a=index&token='.$token.'&id='.$item['id'],'keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }
    //餐饮行业
    public  function  Repast(){

        $token = $_SESSION['userinfo']['token'];;
        $this->db = new Lxdb($this->dbconn);
        $list = $this->db->arrdata( "*",'tp_reply_info', "where  token = '$token' and infotype = 'Dining'");
       // $list = M('reply_info')->where("token='$token' and infotype = 'Dining'")->select();
        $items=array();

        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Repast&a=index&token='.$this->token.'&cid='.$item['id'],'keyword'=>$item['keyword']));

            }
        }

        $list2 = $this->db->arrdata( "*",'tp_dishout_manage',"where  token='$token' ");
       // $list2 = M('dishout_manage')->where("token='$token'")->select();
        if ($list2){
            foreach ($list2 as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['rtitle'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=DishOut&a=MyShop&token='.$token.'&id='.$item['id'].'&cid='.$item['cid'],'keyword'=>$item['keyword']));
//                array_push($items,array('id'=>$item['id'],'name'=>"立即预定",'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Repast&a=preMeal&token='.$token.'&cid='.$item['cid'],'keyword'=>$item['keyword']));
//                array_push($items,array('id'=>$item['id'],'name'=>"我要点菜",'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Repast&a=dishMenu&token='.$token.'&cid='.$item['cid'].'&orid=0','keyword'=>$item['keyword']));
//                array_push($items,array('id'=>$item['id'],'name'=>"我的订单",'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Repast&a=myOrders&token='.$token.'&cid='.$item['cid'],'keyword'=>$item['keyword']));
            }
        }

        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }
    //酒店行业
    public  function Hotels(){
        $this->urlhost = empty($_SERVER["SERVER_NAME"])?$_SERVER["HTTP_HOST"]:$_SERVER["SERVER_NAME"];

        if($this->urlhost== 'kaifa.vq.zhongsou.com' || $this->urlhost == 'zq.zhongsou.com'){
            $this->url= 'http://kaifa.zq.zhongsou.com';
        }else{
            $this->url ='http://qiyue.zhongsou.com';
        }
        $token = $this->token;
        $this->db = new Lxdb( $this->db2conn);
        $info = $this->db->arrdata("*",'qy_users', "where  token = '$token' ");

        if(!empty($info)){

            $info2 = $this->db->arrdata("*",'qy_hotel', "where  uid = '{$info[0]["id"]}' ");
        }

        $items=array();
        if(!empty($info2)){
            array_push($items,array('name'=>"酒店介绍",'linkcode'=>$this->url.'/minisite/hotel/?a=hshow&hid='.$info2[0]["id"].'&type=1'));
            array_push($items,array('name'=>"特价优惠",'linkcode'=>$this->url.'/minisite/hotel/?a=hshow&hid='.$info2[0]["id"].'&type=3'));
            array_push($items,array('name'=>"会员中心",'linkcode'=>$this->url.'/minisite/hotel/?a=ucenter&hid='.$info2[0]["id"]));
            array_push($items,array('name'=>"在线预订",'linkcode'=>$this->url.'/minisite/hotel/?a=booking&hid='.$info2[0]["id"].'&type=1'));
            array_push($items,array('name'=>"订单管理",'linkcode'=>$this->url.'/minisite/hotel/?a=myorderlist&hid='.$info2[0]["id"]));
        }

        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }

    //新版投票 在qiyueII上
    public  function  vote_new(){
        $this->urlhost = empty($_SERVER["SERVER_NAME"])?$_SERVER["HTTP_HOST"]:$_SERVER["SERVER_NAME"];

        if($this->urlhost== 'kaifa.zq.zhongsou.com' || $this->urlhost == 'zq.zhongsou.com'){
            $this->url= 'http://zq.zhongsou.com';
        }else{
            $this->url ='http://qiyue.zhongsou.com';
        }
        $token = $this->token;
        $this->db = new Lxdb( $this->db2conn);
        $info = $this->db->arrdata("*",'qy_users', "where  token = '$token' ");

        if(!empty($info)){
           // $sql2 = "select  * from qy_wxvote where bs_id ='" .$info[0]["id"]."'";
            $info2 = $this->db->arrdata("*",'qy_wxvote',"where bs_id ='".$info[0]['id']."'");
            //$info2 = $infos2->fetch_array();
        }

        $items=array();
        if($info2){
            foreach($info2 as $item){
                array_push($items,array('name'=>$item["name"],'linkcode'=>$this->url.'/app/vote/?g=c&m=vote&a=show_vote&id='.$item["id"]));
            }
        }


        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }
//洒店1.0 .即原来的老企悦的酒店
    public function Hotels_1(){

        $this->db = new Lxdb($this->dbconn);
        $token = $_SESSION['userinfo']['token'];

        $list = $this->db->arrdata( "*",'tp_reply_info',"where  infotype='Hotels' and token='$token' ");
        $items=array();
        if ($list){
            foreach ($list as $item){
                array_push($items,array('id'=>$item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Hotels&a=index&token='.$token.'&id='.$item['id'],'keyword'=>$item['keyword']));
            }
        }
        //
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
    }
    public function Paper(){
        $moduleName = 'Paper';
         $this->smarty->assign('moduleName', $this->modules[$moduleName]);
        $db = M($moduleName);
        $where = $this->where;
        $count = $db->where($where)->count();
        $Page = new Page($count, 5);
        $show = $Page->show();
        $list = $db->where($where)->limit(($Page->firstRow . ',') . $Page->listRows)->order('id DESC')->select();
        $items = array();
        if ($list){
            foreach ($list as $item) {
                array_push($items, array('id' => $item['id'],'name'=>$item['title'],'linkcode'=>$this->vqurl.'index.php?g=Wap&m=Paper&a=index&token='.$this->token.'&id='. $item['id'],'linkurl'=>'','keyword'=>$item['keyword']));
            }
        }
        if($items){
            $data['status'] = 1;
            $data['item'] = $items;
        }else{
            $data['status'] = 0;
        }
        echo json_encode($data);exit;
         $this->smarty->assign('list', $items);
        // $this->smarty->assign('page', $show);
         $this->smarty->display('link_detail.tpl');
    }



    public function changeShow(){
        $id = $_REQUEST['id'];
        $this->db = new Lxdb($this->dbconn);
        $stat = $this->db->oncedata('showtouser','tp_function',$where=" where id = $id");

        if($stat == 1){
            $this->db->updata('tp_function','showtouser = 0',$where="where id = $id");
            echo "showtouser 已经设置为 0"; exit;
        }else{
            $this->db->updata('tp_function','showtouser = 1',$where="where id = $id");
            echo "showtouser 已经设置为 1";exit;
        }

    }
}